HAL RTC migration: List of applicable concepts ¶
This section provides information about the HAL RTC applicable architecture concepts.
List of specific concepts ¶
|
Concept |
Description |
|---|---|
|
The initialization and de-initialization functions have been removed and replaced by a dedicated configuration function. |
|
|
Removal and conversion of init structure to configuration structure |
The HAL RTC handle has been removed. |
|
Calendar and prescaler configuration structures have been renamed. |
|
|
|
|
|
Calendar and prescaler APIs (configuration, structures, and functions) have been split. |
|
|
Individual callback registration APIs replace global register and unregister functions |
The callback registration is handled by specific functions for each RTC event. These functions are used to register callback functions for different RTC events. |
|
HAL RTC APIs now rely on LL APIs rather than performing direct register access. |
|
|
Define statements and enumerations redirected to LL equivalents |
HAL RTC define statements and enumerations are based on LL define statements. |
|
All hardware macros have been removed from the HAL RTC driver, and equivalent services are ensured through the LL APIs. |
|
|
All TypeDef parts of the HAL RTC driver have been removed and replaced by
|
|
|
For the HAL RTC driver, large macros have been replaced by inline functions to maintain code consistency, improve readability, and benefit from compiler optimization. Inline functions also offer better support for debugging and strict type management, reducing the risk of errors. |
|
|
Const keywords have been added to non-modifiable pointers to ensure that either the pointer itself or the data it points to cannot be modified. This enhances code safety and readability, prevents unintended modifications, and renders code more robust and maintainable. |
|
|
Merge HAL extension files with common ones and remove the EX prefix from APIs. |
Only one HAL RTC header file remains and all macros, define statements, and functions from
|
|
The LL source file has been removed. |
|
|
Split Peripheral Configuration from Start in System HAL Drivers. |
In the RTC driver, the alarm and wakeup features are now split between configuration functions and start functions. |
|
Replace Finite Parameter Defines (Including PPP Instances) with Enum Types at HAL Levels. |
Finite parameters (including RTC instances) have been converted into enumerated types (enums) at HAL level. This improves code readability, maintainability, and type safety. |
|
|
Other HAL RTC changes ¶
|
Concept |
Consideration |
|---|---|
|
Split HAL RTC driver |
Create two separate HAL RTC & HAL TAMP drivers mirroring the reference manual. |
|
Remove HAL handle from HAL RTC & TAMP drivers |
No more handle in HAL2 for both RTC and TAMP drivers. |
|
Change write protection usage |
APIs have been added to lock and unlock write protection for users who need to perform these operations before setting the date and time. Date and time setting registers no longer automatically unlock write protection. The following APIs must be used explicitly:
|
|
Add GetDateTime API |
A function has been added to retrieve the current date and time.
|
|
Align the structures and naming convention with POSIX |
Use standard abbreviated field names (sec, min, hour) instead of full names:
|
|
Factorize alarm code |
Update the alarm functionality to allow users to select the specific alarm instance for each desired operation.
|